Skip to content

use FPC LEtoN/BEtoN intrinsics for wire-to-native reads#23

Merged
Xor-el merged 1 commit into
masterfrom
refactor/binprim-fpc-endian-intrinsics
Jun 30, 2026
Merged

use FPC LEtoN/BEtoN intrinsics for wire-to-native reads#23
Xor-el merged 1 commit into
masterfrom
refactor/binprim-fpc-endian-intrinsics

Conversation

@Xor-el

@Xor-el Xor-el commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Replace the hand-rolled {$IFDEF SIMPLEBASELIB_LITTLE_ENDIAN} branches in the six private read-side helpers with FPC's dedicated, self-endian-aware RTL intrinsics:

LeToNativeUInt16/32/64 -> LEtoN
BeToNativeUInt16/32/64 -> BEtoN

The intrinsic is used on FPC; Delphi keeps the existing fallback verbatim via {$ELSE}. Generated little-endian code is unchanged (LEtoN/BEtoN are the identity on LE hosts, a bswap on BE) -- this is an idiomatic/clarity change that drops these functions' reliance on the SIMPLEBASELIB_LITTLE_ENDIAN define and defers the endianness decision to the RTL. All Read* overloads route through these helpers, so the whole read path is covered transitively.

Replace the hand-rolled {$IFDEF SIMPLEBASELIB_LITTLE_ENDIAN} branches in the six private read-side helpers with FPC's dedicated, self-endian-aware RTL intrinsics:

  LeToNativeUInt16/32/64 -> LEtoN
  BeToNativeUInt16/32/64 -> BEtoN

The intrinsic is used on FPC; Delphi keeps the existing fallback verbatim via {$ELSE}. Generated little-endian code is unchanged (LEtoN/BEtoN are the identity on LE hosts, a bswap on BE) -- this is an idiomatic/clarity change that drops these functions' reliance on the SIMPLEBASELIB_LITTLE_ENDIAN define and defers the endianness decision to the RTL. All Read* overloads route through these helpers, so the whole read path is covered transitively.
@Xor-el Xor-el merged commit 851b0fd into master Jun 30, 2026
24 checks passed
@Xor-el Xor-el deleted the refactor/binprim-fpc-endian-intrinsics branch June 30, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant